<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml"
    xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>项目管理</title>
	

    <link rel="shortcut icon" href="favicon.ico"> 
    <link th:href="@{/css/bootstrap.min14ed.css}"  href="css/bootstrap.min14ed.css" rel="stylesheet">
    <link th:href="@{/css/font-awesome.min93e3.css}"  href="css/font-awesome.min93e3.css" rel="stylesheet">
    <link th:href="@{/css/animate.min.css}"  href="css/animate.min.css" rel="stylesheet">
    <link th:href="@{/css/style.min862f.css}"  href="css/style.min862f.css" rel="stylesheet">
    <style>
    	.btn{ margin-right: 5px; padding:1px 6px;}
    	.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th {
	padding:3px; 
}
    </style>
</head>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInRight" >
        <!-- Panel Other -->
        <div class="ibox float-e-margins">
            <div class="ibox-content">
            <div class="alert  alert-info">
                           <h3><span>用户列表</span></h3>
                        </div>
                <div class="row ">
					 <div class="col-sm-12">
                      
                        	
                     	   <div class="col-md-2" style=" padding: 0px;">
                             	<input type="text" class="form-control m-b" id="title" placeholder="请输入用户名">
	                         </div>
	                         
	                         <div class="col-md-4" style=" padding-left: 5px;">
	                        	<button class="btn btn-info"   type="button" onclick="tableRefresh('/getUserList')">搜索</button>
	                        	 <a class="btn  btn-primary"  href="javascript:"  onclick="modify2()"  >新建用户</a>
	                         </div>
	                         <div class="hr-line-dashed" style="clear: both;"></div>
                        
                   
                        <!-- Example Events -->
                        <div class="example-wrap" id="tab-2">
	                         <div class="bootstrap-table">
								<div class="fixed-table-container" style="padding-bottom: 0px;overflow-x:auto;">
									<table id="table1" data-mobile-responsive="true"
                                data-toggle="table" data-url="/getUserList"
                                data-data-type="json" data-side-pagination="server"
                                data-pagination="true" data-query-params="queryParams"
                                data-page-list="[5, 10, 20, 50, 100, 200]">
                                <thead>
                                    <tr>
                                        
                                        <th data-field="userId" data-align="center">用户名</th>
                                        <th data-formatter='isAdmin' data-align="center">类型</th>
                                        <th data-align="center" data-formatter='formatterFun'>操作</th>
                                    </tr>
                                </thead>
                            </table>
							</div>
							
							</div>
							
                        </div>
                     
                        <!-- End Example Events -->
                    </div>
                </div>
            </div>
        </div>
    
        <!-- End Panel Other -->
    </div>
	
<script th:src="@{/js/jquery.min.js}"  src="js/jquery.min.js"></script>
	<script th:src="@{/js/bootstrap.min.js}"  src="js/bootstrap.min.js"></script>
	<script th:src="@{/js/content.min.js}"  src="js/content.min.js"></script>
	<script th:src="@{/js/plugins/iCheck/icheck.min.js}"  src="js/plugins/iCheck/icheck.min.js"></script>
	<script th:src="@{/js/plugins/layer/laydate/laydate.js}"  src="js/plugins/layer/laydate/laydate.js"></script>
	<script th:src="@{/js/layui/layui.js}"  src="js/layui/layui.js"></script>
	<script th:src="@{/js/plugins/bootstrap-table/bootstrap-table.min.js}" src="js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script th:src="@{/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js}" src="js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script th:src="@{/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}" src="js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" th:inline="javascript">
/*<![CDATA[*/
        var table = $("#table1");
        var typeId = $("#typeId").val();
        /*查询条件*/
        function queryParams(params) {
            var typeId=[[${typeId}]];
            params.type=typeId;
            params.title = $("#title").val();
            return params;
        }
        /**刷新*/
        function tableRefresh(dataUrl) {
            table.bootstrapTable('refresh', {
                url : dataUrl
            });
        }

        
        function formatterTime(value) {
            if (value==null ||value==undefined){
                return "暂无时间";
            }
            return new Date(parseInt(value)).toLocaleString().substr(0,20);
        }
        

        function formatterFun(value, row, index) {
            var id=row.userId;
            return '<button class="btn btn-primary " style="margin:5px 15px;" type="button" onclick=modify(\''
            + id + '\')><i class="fa fa-paste"></i> 编辑</button>';
            //+'<button class="btn btn-danger " style="margin:5px 15px;" type="button" onclick=deleteInfo(\''
            //+ id + '\')><i class="fa fa-paste"></i> 删除</button>';
           
        }
        function isAdmin(value, row, index) {
            var isAdmin=row.isAdmin;
            if(isAdmin == 1){
            	return '管理员';
            }
            else{
            	return '普通用户';
            }
            
           
        }
        
        /* function deleteInfo(id){
        	$.ajax({
                url : "/information/delInfo",
                datatype : "json",
                data : {
                    infoId : id,
                },
                type : 'POST',
                async : false,
                success : function(data) {
                    if (data.status != 10001) {
                        alert(data.msg);
                    } else {
                    	alert(data.msg);
                    	tableRefresh('getInfoList')
                    }
                }
            });
        } */

        function modify(id,txt){
        	window.parent.addTable("/getUserInfo?userId="+id,txt);
        }
        function modify2(id,txt){
        	window.parent.addTable("/getUserInfo",txt);
        }
        function totabss(href,txt) {
    		window.parent.addTable(href,txt);
    	}
        /*]]>*/
        </script>
     

	
</body>
</html>